package com.ihd.ihardware.view.tzc.me.viewmodel;

import android.app.Application;
import android.arch.lifecycle.AndroidViewModel;
import android.support.annotation.NonNull;

import com.ihd.ihardware.view.tzc.me.model.MeRepository;

public class DeviceViewModel extends AndroidViewModel {

    private MeRepository mMeRepository;

    public DeviceViewModel(@NonNull Application application) {
        super(application);
    }

    public void unbind(String id) {
        if (mMeRepository == null)
            mMeRepository = new MeRepository();
        mMeRepository.unbind(id);
    }

    @Override
    protected void onCleared() {
        super.onCleared();
        if (null != mMeRepository) {
            mMeRepository.onDestroy();
            mMeRepository = null;
        }
    }
}
